/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.Kernel;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;



/**
 * @generated
 *
 */
public class Constraint extends PackageableElement implements IConstraint {
	// attributes
	
	
	
	
	// references
	
	protected MetaTypedList context;
	
	protected MetaTypedList constraintElement;
	
	protected MetaTypedList specification;
	
	
	
	// getters & setters for attributes
	
	// getters for references
	
	public MetaTypedList getContext() {
		if(context == null) {
			context = new MetaTypedList(Namespace.class, this, ModelPackage.CONSTRAINT_CONTEXT);
		}
		return context;
	}
	
	public MetaTypedList getConstraintElement() {
		if(constraintElement == null) {
			constraintElement = new MetaTypedList(UMLElement.class, this, ModelPackage.CONSTRAINT_CONSTRAINTELEMENT);
		}
		return constraintElement;
	}
	
	public MetaTypedList getSpecification() {
		if(specification == null) {
			specification = new MetaTypedList(ValueSpecification.class, this, ModelPackage.CONSTRAINT_SPECIFICATION);
		}
		return specification;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.CONSTRAINT_CONTEXT, context);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.CONSTRAINT_CONSTRAINTELEMENT, constraintElement);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.CONSTRAINT_SPECIFICATION, specification);		
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		// references
		
		this.getContext().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.CONSTRAINT_CONTEXT, this));
		
		this.getConstraintElement().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.CONSTRAINT_CONSTRAINTELEMENT, this));
		
		this.getSpecification().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.CONSTRAINT_SPECIFICATION, this));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.CONSTRAINT_CONTEXT.equals(featureID)) {
			getContext().add(value);
		}
		
		else if(ModelPackage.CONSTRAINT_CONSTRAINTELEMENT.equals(featureID)) {
			getConstraintElement().add(value);
		}
		
		else if(ModelPackage.CONSTRAINT_SPECIFICATION.equals(featureID)) {
			getSpecification().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 